package org.jeecg.modules.xl.kuaimai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.xl.kuaimai.entity.XlKuaimaiStock;

/**
 * ${DESCRIPTION}
 * @author deco
 * @create 2024-11-07
*/
public interface XlKuaimaiStockMapper extends BaseMapper<XlKuaimaiStock> {
    int batchInsert(@Param("list") List<XlKuaimaiStock> list);

    @Delete("truncate table xl_kuaimai_stock")
    void truncate();

    //stockModifiedTime	 	productName		cartonSpec		productSpec	stockModifiedTime
    @Select("<script>"
            + "select t2.upc_code as upcCode,t2.product_name as productName,t2.carton_spec as cartonSpec,t2.product_spec as productSpec,t1.totalAvailableStock,t1.stockModifiedTime,t1.wareHouseId from xl_kuaimai_stock t1  "
            + "LEFT JOIN xl_product_info t2 on t1.mainOuterId=t2.upc_code "
            + "<if test='brand!=null'>"
            +"where t2.brand =#{brand}  "
            + "</if>"
            + "</script>")
    List<Map> getBrandofStockList(@Param("brand")String brand);

}